package PantallasCliente;
import ControlCliente.ManejadorCrearPartida;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
public class PantallaPartidaCreada implements ActionListener, WindowListener {

/************atributos*******************************************/
    private JFrame ventanaPartidaCreada;
    private ManejadorCrearPartida mcp = new ManejadorCrearPartida();
/*****************************************************************/

/************métodos**********************************************/

    public PantallaPartidaCreada(){}
    public PantallaPartidaCreada(ManejadorCrearPartida mcp) {
        this.mcp = mcp;
        crearPantalla();
        mostrarPantalla();
    }

    public void crearPantalla(){
        ventanaPartidaCreada = new JFrame("El Juego");
        ventanaPartidaCreada.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        ventanaPartidaCreada.setBounds(100, 100, 400, 300);
        ventanaPartidaCreada.getContentPane().setLayout(null);
        ventanaPartidaCreada.addWindowListener(this);

        JLabel txt0 = new JLabel("PARTIDA CREADA CON EXITO!!");
        txt0.setBounds(15, 100, 350, 20);
        ventanaPartidaCreada.getContentPane().add(txt0);

        JButton aceptar = new JButton("Aceptar");
        aceptar.setBounds(80, 250, 100, 20);
        ventanaPartidaCreada.getContentPane().add(aceptar);
        aceptar.setMnemonic(KeyEvent.VK_A);
        aceptar.setActionCommand("aceptar");
        aceptar.addActionListener(this);
    }
    public void mostrarPantalla(){
        ventanaPartidaCreada.setVisible(true);
    }
    public void ocultarPantalla(){
        ventanaPartidaCreada.setVisible(false);
    }
    public void actionPerformed(ActionEvent e) {
         if ("aceptar".equals(e.getActionCommand())){
            ventanaPartidaCreada.setVisible(false);
            mcp.mostrarPantallaPrincipal();
         }
    }

    public void windowOpened(WindowEvent e) { }
    public void windowClosing(WindowEvent e) {
        System.exit(0);
    }
    public void windowClosed(WindowEvent e) {
        System.exit(0);
    }
    public void windowIconified(WindowEvent e) { }
    public void windowDeiconified(WindowEvent e) { }
    public void windowActivated(WindowEvent e) { }
    public void windowDeactivated(WindowEvent e) { }
/*****************************************************************/
    }